Getting Started
This is a virtual computer simulation that demonstrates basic computing concepts. You can write and run simple programs, view memory, and see how a CPU processes instructions.
Basic Commands
- help - Show available commands
- clear - Clear the display
- memory - Show memory contents
- set [address] [value] - Set memory at address to value
- get [address] - Get value at memory address
- run - Run loaded program
- reset - Reset the system
Programming Language
The virtual computer uses a simple instruction set:
- SET [reg] [value] - Set register to value
- LOAD [reg] [address] - Load from memory to register
- STORE [reg] [address] - Store register to memory
- ADD [reg1] [reg2] - Add reg2 to reg1
- SUB [reg1] [reg2] - Subtract reg2 from reg1
- JUMP [line] - Jump to line number/label (LABEL:)
- JZ [reg] [line] - Jump if register is zero
- JL [reg1] [reg2] [line] - Jump if reg1 is less than reg2
- JG [reg1] [reg2] [line] - Jump if reg1 is greater than reg2
- JE [reg1] [reg2] [line] - Jump if reg1 is equal to reg2
- PRINT - Print register A value
- HALT - Stop program execution
Example Program
# count down
SET A 38 # starting number
SET B 5 # initial decrement
SET C 3 # decrement amount
SUB A B # subtract b from a
LOOP:
PRINT # print a
JL A B END # if a not less then b
JE A B END # if a not equal to b
SUB A C # subtract c from a
JUMP LOOP # loop
END:
HALT # end program
About This Computer
This virtual computer is Turing-complete, meaning it can simulate any computation given enough time and memory. It features:
- 256 bytes of memory
- 4 general-purpose registers (A, B, C, D)
- A simple instruction set
- Text-based display output
- Program counter and execution control